package com.huike.web.controller.report;


import com.huike.common.core.domain.AjaxResult;
import com.huike.contract.service.ITbContractService;
import com.huike.report.domain.vo.IndexVo;
import com.huike.report.service.CueConversionService;
import com.huike.report.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/index")
public class IndexController {

@Autowired
private ITbContractService iTbContractService;
    @Autowired
    private CueConversionService cueConversionService;
    @Autowired
    private IndexService indexService;

@GetMapping("/businessChangeStatistics")
public AjaxResult businessChangeStatistics(String beginCreateTime, String endCreateTime, Integer deptId){
//    beginCreateTime=2022-01-25&endCreateTime=2022-02-24&deptId=10
    List<Map<String, Object>> customerConversion = iTbContractService.getCustomerConversion(beginCreateTime, endCreateTime);
    return AjaxResult.success(customerConversion);
    }
@GetMapping
    public AjaxResult index(String beginCreateTime, String endCreateTime){
    IndexVo indexVo = indexService.souYe(beginCreateTime, endCreateTime);
    return AjaxResult.success(indexVo);

}
@GetMapping("/salesStatistic")
public AjaxResult salesStatistic(String beginCreateTime, String endCreateTime){
    List<Map<String, Object>> cueConversion = cueConversionService.getCueConversion(beginCreateTime, endCreateTime);
    return AjaxResult.success(cueConversion);
}
}
